import type { Address, OrderPre, OrderDetail, Logistics, MedicalOrderParams, MedicalOrderPage } from '@/types/order'
import { request } from '@/utils/request'

// 订单-查询收货地址
export const getAddressList = () => request<Address[]>('/patient/order/address')

// 药品订单-支付药款页面-根据处方信息计算药款
export const getMedicalOrderPre = (prescriptionId: string) => request<OrderPre>('/patient/medicine/order/pre', 'GET', { prescriptionId })

// 创建药品订单
export const createMedicalOrder = (data: { id: string; addressId: string; couponId?: string }) => request<{ id: string }>('/patient/medicine/order', 'POST', data)

// 药品订单-查询订单详情信息
export const getMedicalOrderDetail = (id: string) => request<OrderDetail>(`/patient/medicine/order/detail/${id}`)

// 订单-查询物流信息
export const getMedicalOrderLogistics = (id: string) => request<Logistics>(`/patient/order/${id}/logistics`)

// 药品订单-药品订单列表信息
export const getMedicalOrderList = (params: MedicalOrderParams) => request<MedicalOrderPage>('/patient/medicine/order/mylist', 'GET', params)